const sass = require("sass")
const loadGruntTasks = require("load-grunt-tasks")
module.exports = grunt => {
    grunt.initConfig({
        sass: {
            options: {
                implementation: sass,
                sourceMap: true
            },
            main: {
                files: {
                    "dist/css/lx.css": "scss/lx.scss"
                }
            }
        },
        babel: {
            options: {
                sourceMap: true,
                presets: ["@babel/preset-env"]
            },
            main: {
                files: {
                    "dist/js/lx.js": "js/lx.js"
                }
            }
        },
        watch: {
            js: {
                files: ["js/*.js"],
                tasks: ["babel"]
            },
            css: {
                files: ["scss/*.scss"],
                tasks: ["scss"]
            }
        }
    })

    // grunt.loadNpmTasks("grunt-babel")  
    // 加载所有的任务
    loadGruntTasks(grunt)
    grunt.registerTask("default", ['sass', "babel", "watch"])
} 